
from coffeetalk.protocol import responses

class Error(Exception):
    pass

class NotFoundError(Error):
    
    def __init__(self,env,path):
        self.name = 'NotFound'
        self.err = responses.NotFound(requestid=env.requestid,path=path)
        
    def __repr__(self):
        return str(self.err)
    
class UnauthorizedError(Error):
    
    def __init__(self,env,path):
        self.name = 'Unauthorized'
        self.err = responses.Unauthorized(requestid=env.requestid,path=path)
        
class InternalServerError(Error):
    
    def __init__(self,env,path,err):
        self.name = 'InternalError'
        self.err = responses.InternalError(requestid=env.requestid,path=path,err=err)        
      
class Redirect(Error):
    
    def __init__(self,env,path,newpath):
        self.name = 'Redirect'
        self.err = responses.Redirect(requestid=env.requestid,path=path,newpath=newpath)
        
class Accepted(Error):
    
    def __init__(self,env,path,handler):
        self.name = 'Accepted'
        self.err = responses.Accepted(requestid=env.requestid,path=path,handler=handler)
